import unittest
import time

from selenium import webdriver
from Page2 import Page2
from selenium.webdriver.common.by import By
class MyTestCase(unittest.TestCase):
    def setUp(self) -> None:
        # 打开谷歌浏览器
        self.driver = webdriver.Chrome()
        # 窗口最大化
        self.driver.maximize_window()
        print('start case')

    def tearDown(self) -> None:
        # 退出
        self.driver.quit()
        time.sleep(5)
        print('case end')

    def test_something(self):
        po = Page2(self.driver)
        # 调用查询业务
        po.test_search()
        dy = self.driver.find_element(By.XPATH,'/html/body/div[1]/div/section/section/'
          'main/div[1]/div/div[1]/div[3]/div/div[1]/div/table/tbody/tr/td[3]/div').text
        print(f'打印断言1的值:{dy}')
        self.assertEqual(dy, '孟勤凯')
        self.assertNotIn(dy,'李四')
        print(f'断言成功')

if __name__ == '__main__':
    unittest.main()
